home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / scope / 151-175 / scopedisk168 / clianywhere / clianywhere.doc < prev    next >
Text File  |  1995-03-19  |  11KB  |  193 lines

  1.  
  2.  
  3.                            CLIanywhere Version 1
  4.  
  5.                        Created by Ray Lambert in 1990
  6.  
  7.  
  8. Overview.
  9.  
  10.     CLIanywhere is a utility which allows you to open a CLI or Shell on
  11. _any_ screen in your system.  When CLIanywhere is executed, it will cause a
  12. new CLI or Shell to be created on the _topmost_ open screen.  CLIanywhere is
  13. meant to be used with programs such as PopCLI or DMouse.  These programs
  14. allow you to execute a command at the touch of a hot-key (usually
  15. Left-Amiga+Esc) and are most often used to open a new CLI window by
  16. executing "NewCLI" (or "NewShell").  Most of these programs also allow you
  17. to specify the command to be executed.  If you specify "CLIanywhere" as the
  18. command to execute, you can create a new CLI or Shell on the frontmost
  19. screen at virtually anytime just by pressing the hot-key.
  20.  
  21.  
  22. Usage.
  23.  
  24.     CLIanywhere only operates from CLI.  You may execute it from the command
  25. line and then (quickly) move the screen that you want to open a CLI on to
  26. the front, however, CLIanywhere does not take any special steps to ensure
  27. that method of usage will work -- it is really meant for PopCLI-type
  28. programs.  Perhaps in the future this will be supported better.
  29.     Using CLIanywhere from a PopCLI-type program is just as easy as
  30. executing any other program in the same manner.  It may be neccessary to
  31. provide a complete path name for CLIanywhere; see the documentation for your
  32. PopCLI-type program for more information.  CLIanywhere is PURE which means
  33. it can be made resident -- in this case a path name may not be neccessary.
  34. (Making CLIanywhere resident also causes your new CLI to open significantly
  35. faster -- since CLIanywhere is only 564 bytes long, making it resident seems
  36. like a pretty good idea!)
  37.     CLIanywhere allows you to place the command that you wish it to execute
  38. on its command line -- if space characters are neccessary in the command, NO
  39. additional quoting is neccessary.  Alternately, you may place the command
  40. that you wish to execute in a file called "s:CLIanywhere.cmd".  CLIanywhere
  41. will read this file to get your command.  Note that only the first line of
  42. this file will be executed -- any additional lines are ignored.  (See the
  43. enclosed sample file).
  44.     If a command is specified neither on the command line nor in the file
  45. mentioned above, CLIanywhere will use the following default command:
  46.  
  47.              c:NewShell "NEWCON:0/11/640/50/ CLIanywhereShell "
  48.  
  49.     Note that it is possible to use CLIanywhere to execute programs other
  50. than "NewShell" and "NewCLI".  In fact, you can use CLIanywhere to execute
  51. nearly any program that opens a window on Workbench, and doing so will cause
  52. that program's window(s) to open on the topmost screen, in the same manner.
  53.     Using CLIanywhere in conjunction with the enclosed program,
  54. "OpenScreen", it is possible to maintain multiple Workbench screens, each
  55. with their own icons, CLI, etc.!!!  (Try creating a screen with OpenScreen,
  56. opening a CLI or Shell on it with CLIanywhere, and then run "LoadWB" from
  57. the new CLI...)  Please read the enclosed documentation for OpenScreen.
  58.  
  59.  
  60. How It Works.
  61.  
  62.     CLIanywhere uses a simple but obscure 'trick' to fool Intuition into
  63. thinking that the topmost screen at any given time is the Workbench screen.
  64. This 'trick' causes no ill effects to the system, and CLIanywhere's
  65. implementation of this 'trick' does not produce any lasting or noticable
  66. modifications to your environment.  The trick works like this:
  67.  
  68.     All Intuition screens have a 'screen type' value associated with them.
  69. Currently in Workbench 1.3 there are two types called WBENCHSCREEN
  70. (Workbench) and CUSTOMSCREEN (all others).  Workbench 2.0 will introduce one
  71. new screen type, PUBLICSCREEN, however this will have no effect on
  72. CLIanywhere's performance.
  73.     When Intuition tries to find the Workbench screen, it searches the list
  74. of all screens to find the first one which is a WBENCHSCREEN type.  The
  75. screen list is always sorted by topmost to bottommost.
  76.     CLIanywhere temporarily changes the screen type value of the topmost
  77. screen to WBENCHSCREEN (saving its original value) and then executes the
  78. command you give it.  Assuming that the command you give it is "NewShell" or
  79. "NewCLI", Intuition opens the CLI or Shell window on what it thinks is the
  80. Workbench screen, but which we all know is really whatever the topmost
  81. screen is (which could _really_ be Workbench of course).
  82.     Once the command is finished executing, CLIanywhere replaces the topmost
  83. screen's _real_ (saved) 'type' value.  (For you programmer-types reading
  84. this, all of what I describe is done in a protected manner, using
  85. LockIBase(), etc.  However, I cannot keep IntuitionBase locked while I
  86. execute the command because that command will most likely request that a
  87. window be opened, which of course is not possible while IntuitionBase is
  88. locked (result == deadlock).  Therefore, I must save a pointer to the
  89. screen.  Once the command is done executing, I lock IntuitionBase again and
  90. restore the old flag value ONLY IF my saved screen pointer is the same as
  91. the TopMost screen pointer after I re-lock IntuitionBase.  Thus, I am fully
  92. protected.  See the source code for more information.)
  93.  
  94.  
  95. Disclaimer.
  96.  
  97.     Although the trick that CLIanywhere uses is not officially supported by
  98. Commodore (which therefore puts it into the 'hack" category), it does safely
  99. work under all versions of Workbench through 2.0 (yes, I've tested it on 2.0
  100. and it works fine).  I suggest that when you first install CLIanywhere that
  101. you test it a few times (without anything running that could be lost) to be
  102. sure it works properly (and to put your mind at ease [grin]).  This is
  103. especially important to do after you've installed a new version of
  104. Workbench.  I do not expect you to find any problems, however I have not
  105. tested the program in a large number of different system configurations, so
  106. it is possible that it may conflict with something (though I highly doubt
  107. it).  All of this translates to one simple statement:  USE THIS PROGRAM AT
  108. YOUR OWN RISK -- THE AUTHOR ASSUMES NO RESPONSIBILITY FOR THE USE OR MISUSE
  109. OF THIS PROGRAM AND MAKES NO GAURANTEE THAT IT WILL WORK AS DESCRIBED ON ALL
  110. SYSTEMS.
  111.  
  112.  
  113. Warnings.
  114.  
  115.     Some programs do not like to cooperate with strange windows that appear
  116. on their custom screens.  Programs which do not tolerate uninvited windows
  117. usually have good reasons for behaving as such.  In addition, you must
  118. remember that custom screens are really supposed to be private, and
  119. therefore are not required to accomodate uninvited windows.  Deluxe Paint,
  120. for example, doesn't tolerate strange windows on its screen because of
  121. performance reasons -- one of the reasons that DPaint is so fast and
  122. powerful is because it fully takes advantage of the short cuts that are
  123. allowed a custom screen; for example, it does not respect layers.  CygnusEd
  124. Professional also behaves this way and for the same reason -- its
  125. super-fast, blitter-based text scrolling would not be so fast if it took the
  126. time to consider layers.  In fact, most programs which refuse to cooperate
  127. do so for performance reasons, and fail to do so mainly because they ignore
  128. layers (layers is a concept built into Intuition which makes multiple
  129. windows possible).
  130.     Generally, you can still open an uninvited CLI window on a screen which
  131. ignores layers as long as you do not activate other windows on the screen
  132. while your uninvited CLI is there.  For example, it is possible to open a
  133. CLI on CygnusEd's screen, use the CLI and then close it as soon as you're
  134. done with it, with no problem.  However, if you try to type into your
  135. document or scroll the screen while the CLI is there you will end-up with a
  136. mess!  A program such as CygnusEd may open its own windows on its screen,
  137. however this does not imply that it will cooperate with _your_ CLI window.
  138. Usually if a program does open its own windows, it will disable all of its
  139. functions which override the layer system.  For example, when CygnusEd opens
  140. a window (such as its file requester) you are not allowed to type into your
  141. document or scroll through it.
  142.     I have never had a crash as a result of opening an uninvited CLI window
  143. on a private screen.  Nevertheless, I suggest that you avoid doing this with
  144. programs that don't fully cooperate.  If you insist on doing this however,
  145. you should use care.
  146.     Although there are programs which act as I've described, you'll find
  147. that the vast majority of programs do cooperate.
  148.  
  149.     I must make one final warning which is probably most important of all.
  150. When you open an uninvited CLI window on some program's private screen, that
  151. program has no knowledge at all of your window's existence.  It is possible
  152. that a program may attempt to close its screen while your visiting CLI
  153. window is open on its screen.  While it is very unlikely that this will
  154. actually cause a crash, it is not good practice to allow this to happen.
  155. Therefore, you should NEVER instruct a program to close it's screen before
  156. first closing your visiting CLI window.  Even if this does not crash your
  157. Amiga, you _will_ lose some memory and other resources (at least until you
  158. reboot).
  159.     Enclosed in this archive is a program called "ScreenWatch" which will
  160. help protect you from accidently closing a screen while there is still a
  161. window open on it.  It will also protect you from programs which decide to
  162. close their custom screens on their own (without your instructing them to).
  163. ScreenWatch is a very small program and works quite effectively -- if you
  164. intend to use CLIanywhere I strongly suggest that you also use ScreenWatch
  165. as well.  Please read the enclosed documentation for ScreenWatch.
  166.  
  167.  
  168. Legal stuff.
  169.  
  170.     CLIanywhere is public domain.  I have included the source code so that
  171. other programmers can see how this trick works.  Also, this documentation
  172. has some important warnings and disclaimers in it.  Because of this, I
  173. request that this documentation and the enclosed source code are distributed
  174. together with the executable, without exception.  I would also very much
  175. like the accompanying programs, ScreenWatch and OpenScreen, and their source
  176. code and documentation, to be distributed with CLIanywhere as well.
  177.  
  178.  
  179. Get to know me!
  180.  
  181.     If you have any questions, suggestions, flames, propositions, etc., I
  182. can be reached at the following places:
  183.  
  184. People/Link:  Analog*Kid    (log on often)
  185.  
  186. BIX:          AnalogKid     (log on sparsely)
  187.  
  188. U.S. Snail:   Ray Lambert
  189.               PO Box 1253
  190.               Westport, Massachusetts  02790
  191.  
  192. Phone:        (508) 677-9217
  193.